home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / oldwish / RCS / wishGarbage.c,v < prev    next >
Encoding:
Text File  |  1989-01-11  |  5.3 KB  |  245 lines

  1. head     1.3;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.3
  10. date     89.01.11.11.59.36;  author mlgray;  state Exp;
  11. branches ;
  12. next     1.2;
  13.  
  14. 1.2
  15. date     88.11.02.14.50.24;  author mlgray;  state Exp;
  16. branches ;
  17. next     1.1;
  18.  
  19. 1.1
  20. date     88.10.03.12.47.37;  author mlgray;  state Exp;
  21. branches ;
  22. next     ;
  23.  
  24.  
  25. desc
  26. @X11: works pretty much now.
  27. @
  28.  
  29.  
  30. 1.3
  31. log
  32. @Temporary checkin
  33. @
  34. text
  35. @/* 
  36.  * wishGarbage.c --
  37.  *
  38.  *    Garbage collection routines.
  39.  *
  40.  * Copyright 1987 Regents of the University of California
  41.  * All rights reserved.
  42.  * Permission to use, copy, modify, and distribute this
  43.  * software and its documentation for any purpose and without
  44.  * fee is hereby granted, provided that the above copyright
  45.  * notice appear in all copies.  The University of California
  46.  * makes no representations about the suitability of this
  47.  * software for any purpose.  It is provided "as is" without
  48.  * express or implied warranty.
  49.  */
  50.  
  51. #ifndef lint
  52. static char rcsid[] = "$Header: /a/newcmds/wish/RCS/wishGarbage.c,v 1.2 88/11/02 14:50:24 mlgray Exp Locker: mlgray $ SPRITE (Berkeley)";
  53. #endif not lint
  54.  
  55.  
  56. #ifndef AllPlanes
  57. #include "X11/Xlib.h"
  58. #endif
  59. #include "wishInt.h"
  60.  
  61.  
  62. /*
  63.  *----------------------------------------------------------------------
  64.  *
  65.  * WishGarbageCollect --
  66.  *
  67.  *    Garbage collection.
  68.  *
  69.  * Results:
  70.  *    None.
  71.  *
  72.  * Side effects:
  73.  *    Stuff is deallocated, destroyed, deleted and otherwise caused to
  74.  *    be missing.
  75.  *
  76.  *----------------------------------------------------------------------
  77.  */
  78. void
  79. WishGarbageCollect(aWindow)
  80.     WishWindow    *aWindow;
  81. {
  82.     WishGroup    *tmpGroupPtr;
  83.     WishGroup    *tmpNextGPtr;
  84.     WishSelection    *tmpSelPtr, *selPtr;
  85.  
  86.     WishClearWholeSelection(aWindow);
  87.     for (tmpGroupPtr = aWindow->groupList; tmpGroupPtr != NULL;
  88.         tmpGroupPtr = tmpNextGPtr) {
  89.     tmpNextGPtr = tmpGroupPtr->nextPtr;
  90.     WishGarbageGroup(aWindow, tmpGroupPtr);
  91.     }
  92.     aWindow->groupList = NULL;
  93.     aWindow->numElements = -1;
  94.     aWindow->numGroups = -1;
  95.     aWindow->numHiddenGroups = 0;
  96.     aWindow->firstElement = -1;
  97.     aWindow->lastElement = -1;
  98.     for (selPtr = aWindow->selectionList;
  99.         selPtr != NULL && selPtr->nextPtr != NULL; ) {
  100.     tmpSelPtr = selPtr->nextPtr;
  101.     free(selPtr);
  102.     selPtr = tmpSelPtr;
  103.     }
  104.     aWindow->totalDisplayEntries = 0;
  105.  
  106.     return;
  107. }
  108.  
  109.  
  110. /*
  111.  *----------------------------------------------------------------------
  112.  *
  113.  * WishGarbageGroup --
  114.  *
  115.  *    Garbage collection for a single group.  It frees the space for the
  116.  *    group structure as well as all resources allocated to the group.
  117.  *
  118.  * Results:
  119.  *    None.
  120.  *
  121.  * Side effects:
  122.  *    Stuff is deallocated, destroyed, deleted and otherwise caused to
  123.  *    be missing.
  124.  *
  125.  *----------------------------------------------------------------------
  126.  */
  127. void
  128. WishGarbageGroup(aWindow, grpPtr)
  129.     WishWindow    *aWindow;
  130.     WishGroup        *grpPtr;
  131. {
  132.     WishFile    *tmpFilePtr;
  133.     WishFile    *tmpNextFPtr;
  134.  
  135.     if (grpPtr->headerWindow != UNINITIALIZED && grpPtr->headerWindow != 0) {
  136.     XDeleteContext(wishDisplay, grpPtr->headerWindow,
  137.         wishGroupWindowContext);
  138.     XDeleteContext(wishDisplay, grpPtr->headerWindow,
  139.         wishWindowContext);
  140.     XDestroyWindow(wishDisplay, grpPtr->headerWindow);
  141.     }
  142.     if (grpPtr->fileList == NULL && aWindow->hideEmptyGroupsP) {
  143.     aWindow->numHiddenGroups--;
  144.     }
  145.     aWindow->numGroups--;
  146.     for (tmpFilePtr = grpPtr->fileList; tmpFilePtr != NULL;
  147.         tmpFilePtr = tmpNextFPtr) {
  148.     tmpNextFPtr = tmpFilePtr->nextPtr;
  149.     if (tmpFilePtr->name != NULL) {
  150.         free(tmpFilePtr->name);
  151.     }
  152.     aWindow->numElements--;
  153.     free(tmpFilePtr);
  154.     }
  155.     if (grpPtr->rule != NULL) {
  156.     free(grpPtr->rule);
  157.     }
  158.     WishDeleteGroupBindings(grpPtr);
  159.     free(grpPtr);
  160.  
  161.     /*
  162.      * Reset total number of visible elements to the number of files plus
  163.      * the number of headers for visible groups + the number of spaces
  164.      * between visible groups.  This calculation is performed in
  165.      * WishGatherNames() and WishGatherSingleGroup() as well, but garbage
  166.      * collection of a single group affects this number as well.
  167.      */
  168.     aWindow->totalDisplayEntries = aWindow->numElements +
  169.         (2 * (aWindow->numGroups - aWindow->numHiddenGroups)) - 1;
  170.  
  171.     return;
  172. }
  173. @
  174.  
  175.  
  176. 1.2
  177. log
  178. @fsflat changed to wish
  179. @
  180. text
  181. @d18 1
  182. a18 1
  183. static char rcsid[] = "$Header: wishGarbage.c,v 1.1 88/10/03 12:47:37 mlgray Exp $ SPRITE (Berkeley)";
  184. @
  185.  
  186.  
  187. 1.1
  188. log
  189. @Initial revision
  190. @
  191. text
  192. @d2 1
  193. a2 1
  194.  * fsflatGarbage.c --
  195. d18 1
  196. a18 1
  197. static char rcsid[] = "$Header: fsflatGarbage.c,v 1.6 88/06/10 13:14:32 mlgray Exp $ SPRITE (Berkeley)";
  198. d25 1
  199. a25 1
  200. #include "fsflatInt.h"
  201. d31 1
  202. a31 1
  203.  * FsflatGarbageCollect --
  204. d45 2
  205. a46 2
  206. FsflatGarbageCollect(aWindow)
  207.     FsflatWindow    *aWindow;
  208. d48 3
  209. a50 3
  210.     FsflatGroup    *tmpGroupPtr;
  211.     FsflatGroup    *tmpNextGPtr;
  212.     FsflatSelection    *tmpSelPtr, *selPtr;
  213. d52 1
  214. a52 1
  215.     FsflatClearWholeSelection(aWindow);
  216. d56 1
  217. a56 1
  218.     FsflatGarbageGroup(aWindow, tmpGroupPtr);
  219. d79 1
  220. a79 1
  221.  * FsflatGarbageGroup --
  222. d94 3
  223. a96 3
  224. FsflatGarbageGroup(aWindow, grpPtr)
  225.     FsflatWindow    *aWindow;
  226.     FsflatGroup        *grpPtr;
  227. d98 2
  228. a99 2
  229.     FsflatFile    *tmpFilePtr;
  230.     FsflatFile    *tmpNextFPtr;
  231. d102 5
  232. a106 5
  233.     XDeleteContext(fsflatDisplay, grpPtr->headerWindow,
  234.         fsflatGroupWindowContext);
  235.     XDeleteContext(fsflatDisplay, grpPtr->headerWindow,
  236.         fsflatWindowContext);
  237.     XDestroyWindow(fsflatDisplay, grpPtr->headerWindow);
  238. d124 1
  239. a124 1
  240.     FsflatDeleteGroupBindings(grpPtr);
  241. d131 1
  242. a131 1
  243.      * FsflatGatherNames() and FsflatGatherSingleGroup() as well, but garbage
  244. @
  245.